﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class Default2 : System.Web.UI.Page
{
    int productId;

    CategoryController cateControl;
    ProductsController productColtrol;

    DataTable dtMenu;
    DataTable dtSamePrice;
    DataTable dtSameCategory;

    public List<Category> ListCate = new List<Category>();
    protected void Page_Load(object sender, EventArgs e)
    {
        productId = Convert.ToInt32(Request.QueryString["id"]);

        productColtrol = new ProductsController();
        cateControl = new CategoryController();

        dtMenu = cateControl.getAllCategory();
        dtSamePrice = productColtrol.GetSamePrice(productId);
        dtlSamePrice.DataSource = dtSamePrice;
        dtlSamePrice.DataBind();
        dtSameCategory = productColtrol.GetSameCategory(productId);
        dtlSameCategory.DataSource = dtSameCategory;
        dtlSameCategory.DataBind();

        LoadCate();
    }
    public void LoadCate() {
        foreach (DataRow item in dtMenu.Rows)
        {
            ListCate.Add(new Category(item));
        }
    }
}